<?php 
/***********************************************strat店铺API***************************************************/ 
  	/**
	 * taobao.shopcats.list.get:获取前台展示的店铺类目 [查]
	 **/
	 function TOP_ShopcatsListGet($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,shopcatsListGet); 
	 }
	/**
	 * taobao.sellercats.list.get:获取前台展示的店铺内卖家自定义商品类目 [查]
	 **/
	 function TOP_SellercatsListGet($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,sellercatsListGet); 
	 }
	/**
	 *  taobao.sellercats.list.add:添加卖家自定义类目 [卖]
	 **/
	 function TOP_SellercatsListAdd($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,sellercatsListAdd); 
	 } 
 	/**
	 * taobao.sellercats.list.update:更新卖家自定义类目   [卖]
	 **/
	 function TOP_SellercatsListUpdate($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,sellercatsListUpdate); 
	 }
 	/**
	 *  taobao.shop.get:获取卖家店铺的基本信息   [查]
	 **/
	 function TOP_ShopGet($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,shopGet); 
	 }
 	/**
	 *  taobao.shop.update:更新店铺基本信息，目前只支持标题、公告和描述  [卖]
	 **/
	 function TOP_ShopUpdate($userParamArr){
	    $client = new Client();  
	    setUserParameter($client,$userParamArr);  
	    return returnCallBackPage($client,shopUpdate); 
	 } 
/***********************************************end店铺API***************************************************/ 	
	  

   /**
	 * taobao.shopcats.list.get(获取前台展示的店铺类目) [查] 
	 * 
	 * */
	function GetShopCats(){
		global $_CFG, $exc,$db,$os,$topParamArr;  
		$array1= $topParamArr;
	    $array1['method']='taobao.shopcats.list.get';  // 
		//API用户参数   
//		$result = lib_getArray_params( $array1  ); 
//		print_r($result);
//		die('===>');
	}
	/**
	 * taobao.shop.get:获取卖家店铺的基本信息  [查] 
	 * 
	 * */
	function GetShop(){ 
		//API用户参数
		$userParamArr = array(  
						'fields' =>'sid,cid,title,nick,desc,bulletin,pic_path,created,modified', 
	     			);     
 		$result =TOP_ShopGet($userParamArr)  ; 
		if(is_array($result['shop'] )  ){ 
			$tb_shop = array(  
					    'sid'  	         		=>$result['shop']['sid']   ,
					 	'cid'     	    		 =>$result['shop']['cid'] ,
					 	'title'     			 => addslashes($result['shop']['title'])   , 
					 	'nick'     			 => addslashes($result['shop']['nick'])   , 
					 	'created'    		 =>$result['shop']['created']   , 
					 	'modified'   		 => $result['shop']['modified']  
					); 
			 OS_InsertIntoTB('tb_shop','sid',$tb_shop);	 
		}else {
			echo ('taobao.shop.get请求出错['.$result['code'] .']'.$result['msg']."<br/>"  );
		}  
	} 
	/** 
	 * taobao.sellercats.list.get(获取前台展示的店铺内卖家自定义商品类目) [查]
	 *
	 * */
	function GetShopSellercats(){ 
		$userParamArr = array(  
						'nick'=> API_USER,  
	     			);    
		$result = TOP_SellercatsListGet( $userParamArr );
		if( $result['seller_cat'] ){
			  foreach ( $result['seller_cat'] as $seller_cat ){  
				$tb_sellercat = array(  
				    'cid'  	         		=> $seller_cat['cid'] ,
				 	'parent_cid'     	     => $seller_cat['parent_cid'] ,
				 	'name'     			 =>  addslashes( $seller_cat['name']) ,
				 	'pict_url'    		 =>  addslashes( $seller_cat['pict_url']) ,
				 	'sort_order'   		 =>addslashes( $seller_cat['sort_order']  ) ,
				 	'nick'         => API_USER,  
				);  
				OS_InsertIntoTB('tb_sellercat','cid',$tb_sellercat,"parent_cid='".$seller_cat['parent_cid']."'"); 
			} 
		}else {
			echo ('taobao.sellercats.list.get请求出错['.$result['code'].']'.$result['msg'] .'<br/>' );
		} 
	} 




?>


